home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / c-tools / tds / convsrc / oberon2msg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-01  |  1.6 KB  |  83 lines

  1. /* Oberon2Msg.c */
  2.  
  3. #include <exec/types.h>
  4. #include <dos/stdio.h>
  5. #include <dos/dostags.h>
  6. #include <clib/dos_protos.h>
  7. #include <clib/exec_protos.h>
  8.  
  9. #include <stdio.h>
  10. #include <string.h>
  11.  
  12. static UBYTE version[] = "$VER: Oberon2Msg 1.00 (28.01.94)";
  13.  
  14. /* Oberon 3.0
  15.   -------
  16.  
  17.   6:   i: INTEER;
  18.                 ^
  19.        25: Bezeichner nicht definiert
  20.        38: Typ erwartet
  21.  
  22.   -------
  23.  
  24.   9:   FOR i:= TO 10 DO
  25.           ^
  26.       183: Bezeichner nach FOR muß Integer-Variable sein
  27.               ^
  28.        67: Faktor erwartet
  29. */
  30.  
  31.  
  32. void
  33. OberonMsg(BPTR fh,UBYTE *filename)
  34. {
  35. UBYTE buffer[256];
  36. UBYTE errstr[256];
  37. LONG errnum,row;
  38.  
  39.   while (FGets(fh,buffer,255)) {
  40.     if (strspn(buffer," ") > 2) {      /* error message */
  41.       if (sscanf(buffer," %ld: %[^\n]",&errnum,errstr) == 2)
  42.         Printf("<%s> %ld E <%ld: %s>\n",filename,row,errnum,errstr);
  43.     }
  44.     else                /* row number */
  45.       sscanf(buffer," %ld:",&row);
  46.   }
  47. }
  48.  
  49.  
  50. /* Usage: Oberon2Msg source-file */
  51.  
  52. int
  53. main(int argc,UBYTE *argv[])
  54. {
  55. BPTR fh;
  56. UBYTE errfile[32];
  57. UBYTE cmdstr[256];
  58. LONG exitcode;
  59. BOOL done = FALSE;
  60.  
  61.   if (argc > 1) {
  62.     sprintf(errfile,"T:Oberon2Msg%0lx",FindTask(NULL));
  63.     fh = Open(errfile,MODE_NEWFILE);
  64.     if (fh) {
  65.       sprintf(cmdstr,"OBERON:OErr %s\n",argv[1]);
  66.       exitcode = SystemTags(cmdstr,SYS_Input,NULL,SYS_Output,fh,TAG_DONE);
  67.       Close(fh);
  68.       
  69.       if (exitcode == 0) {
  70.         fh = Open(errfile,MODE_OLDFILE);
  71.         if (fh) {
  72.           OberonMsg(fh,argv[1]);
  73.           Close(fh);
  74.           DeleteFile(errfile);
  75.           done = TRUE;
  76.         }
  77.       }
  78.     }
  79.   }
  80.   return(done ? 0 : 20);
  81. }
  82.  
  83.